﻿@using IBS.Model
@model IEnumerable<IBS.Model.Transfer>
@{
    ViewBag.Title = "Statement";
    Layout = "~/Views/Shared/_Payment_Menu.cshtml";
}
<h2>
    Statement</h2>
<div>
    @Html.Partial("_Filter", "#paymentForm")
</div>
@{
    var grid = new WebGrid(
        canSort: false,
        rowsPerPage:10
        );
    grid.PageIndex = ViewBag.CurrentPage - 1;
    grid.Bind(Model, null, autoSortAndPage: false, rowCount: ViewBag.TotalRecordsCount);
}

@if (Model.Count() > 0)
{
    @grid.GetHtml(
    
        tableStyle: "grid",
        headerStyle: "header",
        rowStyle: "row",
        footerStyle: "footer",
        alternatingRowStyle: "row",
        columns: grid.Columns(
            grid.Column( "FromCard.Number", "Card Number", style: "textCol"),
            grid.Column("FromAccountAmount", "Paid", format:i=>i.FromAccountAmount.ToString("0.####"), style: "textCol block"),
                grid.Column("FromAccount.Currency.ISO", "Currency", style: "textCol block"),
                grid.Column("CurrencyRate", "Currency Rate", format: i => (i.CurrencyRate != null)? i.CurrencyRate.ToString("0.####"): null, style: "textCol block"),
            grid.Column("Status", "Status",format:i=> (TransferStatus)i.Status, style: "textCol block"),
            grid.Column("StartDate", "Start Date", format: i => (i.StartDate != null) ? i.StartDate.ToString("MM/dd/yy hh:mm:ss"): null, style: "textCol block"),
            grid.Column("EndDate", "End Date", format: i => i.EndDate != null? i.EndDate.ToString("MM/dd/yy hh:mm:ss"): null, style: "textCol block"),
            grid.Column("Bill", format: (item) =>
                            Html.ActionLink("Get Bill", "GetBill", "Bill", new {transferId = item.Id}, null)
                    )
        ))
  
}else
{
    <label>
        No information available
    </label>   
}